let baseUrl = 'https://yl.weilankangyang.com';
export function uploadFile(obj) {
    console.log(obj, "objjjj")
    return new Promise((resolve, reject) => {
        uni.uploadFile({
            url: baseUrl + obj.url, //请求地址
            filePath: obj.data, //图片路径
            name: 'file',
            header: {
                "token": uni.getStorageSync('token'),
            },
            timeout: 2000,
            // formData: data,
            success: (res) => {
                if (res.statusCode == 200) {
                    console.log(res,"123")
                    resolve(JSON.parse(res.data))
                }
            },
            fail: (error) => {
                console.log(error); //抛出异常
                if (error.errMsg == "uploadFile:fail timeout") {
                    uni.showToast({
                        title: '请求超时',
                        mask: true,
                        icon: 'error'
                    })
                }
            },
            complete: () => {
                uni.hideLoading()
            }
        })
    })
}